package com.copractice.bl;

import com.google.inject.Guice;
import com.google.inject.Injector;

/**
 * Factory class for getting instances of business logic module classes with default bindings.
 * Default binding settings are in the @{link BLModule} class.
 * 
 * @author Dmitry Churbanov (dmitry.churbanov@gmail.com)
 * @version 1.0 01/04/2010
 */
public class BLFactory {
    
    private static Injector injector;
    
    private static Injector getInjector() {
        if (injector == null) {
            injector = Guice.createInjector(new BLModule());
        }
        return injector;
    }

    public static <T> T getInstance(Class<T> clazz) {
        return getInjector().getInstance(clazz);
    }

}
